import { Role } from "../type";
import { MentuItems } from "../type/layout";
import BannerMange from "../pages/bannerMange";
import ActiveManage from "../pages/activeManage";
import UserAdmin from "../pages/userAdmin";
import RegisterManage from "../pages/registerManage";
import Charts from "../pages/charts";

/*
  暴露不可变的菜单数组
  根据role来划分权限
*/
export const getMenus = (): MentuItems[] =>
  [
    {
      label: "轮播图管理",
      key: "bannerManage",
      roles: [Role.BANNERMANAGE],
      component: BannerMange,
    },
    {
      label: "图标管理",
      key: "charts",
      roles: [Role.CHARTS],
      component: Charts,
    },
    {
      label: "活动管理",
      key: "activeManage",
      roles: [Role.ACTIVEMANAGE],
      component: ActiveManage,
    },
    {
      label: "用户管理",
      key: "userManage",
      roles: [Role.USERMANAGE],
      children: [
        {
          label: "注册用户管理",
          key: "userManage/registerManage",
          roles: [Role.USERMANAGE],
          component: RegisterManage,
        },
        {
          label: "后台用户管理",
          key: "userManage/userAdmin",
          roles: [Role.USERMANAGE],
          component: UserAdmin,
        },
      ],
    },
  ] as MentuItems[];

/*
  暴露默认高亮数组
*/
export const defaultMenuActive = (): string[] => [
  "charts",
  "bannerManage",
  "activeManage",
  "userManage",
  "registerManage",
  "userAdmin",
];
